<?php
/**
 * Order Dao definition 
 *
 * @author Steve
 * @since 2009-10-16
 */
require_once BaseUtil::getModulePath("base") . '/models/BaseDao.php';
class OrderJournalDao extends BaseDao
{
    protected $_name;
    public function _setup ()
    {
        $this->_name = $this->prefix() . "order_journals";
        parent::_setup();
    }
    
    public function getJournalByOrderId($orderId){
    	$select=$this->db_r->select();
        $select->from($this->_name);
        $select->joinLeft('admins',"$this->_name.admin_id=admins.id",'admins.username as operator'); 
        $select->where("$this->_name.order_id=?",$orderId);
        $select->where("$this->_name.is_delete=0");        
        $sql=$select->__toString();
        $result=$this->db_r->fetchAll($sql);
        return $result;
    }
    
    public function deleteJournal($journalId){
    	$isDel = array("is_delete"=>1);
    	$where = $this->db_w->quoteInto('id=?', $journalId);
    	$this->updateData($isDel, $where);
    }
}
?>